package chapter13.ss;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class MyTestComparator {
    public static void main(String[] args) {
        Circle c1 = new Circle(4);
        Circle c2 = new Circle(5);
        Circle c3 = new Circle(7);
        ArrayList<Circle> list = new ArrayList<>();
        list.add(c1);
        list.add(c2);
        list.add(c3);
        Collections.sort(list,new CircleComparator());
        for (Circle one : list)
            System.out.println(one.getArea());
        System.out.println();
        Comparator<Circle> re = Collections.reverseOrder(new CircleComparator());
        Collections.sort(list,re);
        for (Circle one : list)
            System.out.println(one.getArea());
        System.out.println();
        Collections.shuffle(list);
        for (Circle one : list)
            System.out.println(one.getArea());
        System.out.println();
        System.out.println(Collections.max(list,new CircleComparator()).getArea());
    }
}
